// 文章相关的接口
import request from "@/utils/request.js";

// 获取频道对应的文章列表
export const getChanArticle = params => {
  return request({
    url: "/app/v1_1/articles",
    method: "GET",
    params
  });
};

// 封装不敢兴趣删除当前文章的接口
export const dislike = id => {
  return request({
    method: "POST",
    url: "/app/v1_0/article/dislikes",
    data: {
      target: id
    }
  });
};

// 删除举报文章接口
export const delReportArticle = data => {
  return request({
    method: "POST",
    url: "/app/v1_0/article/reports",
    data
  });
};

// 获取指定文章id的详细信息
export const getArticleDetail = id => {
  return request({
    method: "GET",
    url: `/app/v1_0/articles/${id}`
  });
};

// 关注文章作者接口
export const followAuthor = aut_id => {
  return request({
    method: "POST",
    url: "/app/v1_0/user/followings",
    data: {
      target: aut_id
    }
  });
};
// 取消关注文章作者接口
export const disFollowAuthor = aut_id => {
  return request({
    method: "DELETE",
    url: `/app/v1_0/user/followings/${aut_id}`
  });
};

// 对文章点赞接口
export const giveLike = art_id => {
  return request({
    method: "POST",
    url: "/app/v1_0/article/likings",
    data: {
      target: art_id
    }
  });
};
// 对文章取消点赞接口
export const disGiveLike = art_id => {
  return request({
    method: "DELETE",
    url: `/app/v1_0/article/likings/${art_id}`
  });
};

// 对文章不喜欢接口
export const dislikeArticle = art_id => {
  return request({
    method: "POST",
    url: "/app/v1_0/article/dislikes",
    data: {
      target: art_id
    }
  });
};
// 对文章取消不喜欢接口
export const cancelDislike = art_id => {
  return request({
    method: "DELETE",
    url: `/app/v1_0/article/dislikes/${art_id}`
  });
};
